package com.zjljr.mqConsumer.listener;

import com.zjljr.common.message.PraiseMessage;
import com.zjljr.mqConsumer.service.PraiseService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.Message;

import java.util.function.Consumer;

@Configuration
public class PraiseListener {

    @Bean
    public Consumer<Message<PraiseMessage>> consumer(PraiseService praiseService){
        return message -> praiseService.praise(message.getPayload().getItemId());
    }
}
